package com.jjpro.config;

import com.jjpro.intercept.CheckSignInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

@Configuration
public class InterceptorConfig extends WebMvcConfigurerAdapter {

    @Bean
    public CheckSignInterceptor getCheckSignInterceptor(){
        return new CheckSignInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(getCheckSignInterceptor()).addPathPatterns("/test")
                .excludePathPatterns("/");
        super.addInterceptors(registry);
    }

}
